﻿using Alos.Entity;
using Alos.IRepository;
using PetaPoco;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Alos.Repository
{
    public class ChapterRepository : BaseRepository<Chapter>, IChapterRepository
    {
       /// <summary>
        /// 根据教材编号获取章节
       /// </summary>
       /// <param name="id"></param>
       /// <returns></returns>
        public IEnumerable<dynamic> GetChapterByMid(int id)
        {
            var sql = Sql.Builder.Append(" SELECT A.ID,A.FatherID,A.PointName,A.Content,A.TeachingMaterialID FROM [dbo].[Chapter] A ");

            sql.Where(" A.TeachingMaterialID=@0 ", id);

            return DBContext.Query<dynamic>(sql);

        }
    }
}
